<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Using custom HTML</title>
</head>
<body>
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.2.0/styles/default.min.css">
<script src="https://unpkg.com/@highlightjs/cdn-assets@11.2.0/highlight.min.js"></script>

<script>
  //highlight: (codeOrLanguageName: string, optionsOrCode: string | HighlightOptions, ignoreIllegals?: boolean) => HighlightResult
  /*
    export interface HighlightOptions {
        language: string
        ignoreIllegals?: boolean
    }
  */
  const r = hljs.highlight('<span>Hello World!</span>',{
    language:'html'
  })

  console.log(r);
  /*
    Object
      code: "<span>Hello World!</span>"
      illegal: false
      language: "html"
      relevance: 2
      value: "<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">span</span>&gt;</span>Hello World!<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">span</span>&gt;</span>"
      _emitter: c {rootNode: {…}, stack: Array(1), options: {…}}
      _top: {name: "HTML, XML", aliases: Array(10), case_insensitive: true, contains: Array(10), rawDefinition: ƒ, …}
      [[Prototype]]: Object
  */

    /*
      language: language name, same as the name passed in languageName, returned for consistency with highlightAuto

      relevance: integer value representing the relevance score
      相关性：表示相关性分数的整数值

      value: HTML string with highlighting markup

      top: top of the current mode stack

      illegal: boolean representing whether any illegal matches were found

      code: the original raw code
    */
</script>
</body>
</html>
